/**
 * 
 */
package com.geezdata.cps.ttk.integration.wechat.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.geezdata.cps.sdk3rd.wechat.WechatClient;
import com.geezdata.cps.sdk3rd.wechat.request.WechatLoginRequest;
import com.geezdata.cps.sdk3rd.wechat.response.WechatLoginResult;
import com.geezdata.cps.ttk.integration.config.TtkIntegrationConfig;
import com.geezdata.cps.ttk.integration.wechat.WechatloginService;


@Service
public class WechatLoginServiceImpl implements WechatloginService {
    @Autowired
    private TtkIntegrationConfig ttkConfig;
    @Autowired
    private WechatClient wechatClient;

	@Override
	public  WechatLoginResult getWechatLogin(String code) {
        WechatLoginRequest wechatLoginRequest =  new WechatLoginRequest();
        wechatLoginRequest.setJsCode(code);
        wechatLoginRequest.setAppId(ttkConfig.getWchantDxzAppId());
        wechatLoginRequest.setSecret(ttkConfig.getWechatDxzAppSecret());
        return wechatClient.execute(wechatLoginRequest);
    }
}
